﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace DisplayBoardInfo.Server.Forms.Administrator
{
    public partial class DatabaseSettings : CustomComponents.FormDialog
    {
        public DatabaseSettings()
        {
            InitializeComponent();
        }

        protected override void InitlializeForm()
        {
            this.Invoke((MethodInvoker)delegate()
            {
                hostTextBox.Text = Model.Database.Host;
                instanceTextBox.Text = Model.Database.Instance;
                dbNameTextBox.Text = Model.Database.Name;
                usernameTextBox.Text = Model.Database.Username;
                passTextBox.Text = Model.Database.Password;
            });
        }

        private void button1_Click(object sender, EventArgs e)
        {
            Model.Database.Host = hostTextBox.Text;
            Model.Database.Instance = instanceTextBox.Text;
            Model.Database.Name = dbNameTextBox.Text;
            Model.Database.Username = usernameTextBox.Text;
            Model.Database.Password = passTextBox.Text;
            this.DialogResult = System.Windows.Forms.DialogResult.OK;
        }
    }
}
